package STUDENT.TranNamAnh.OOPs.baitap2;

import java.util.Scanner;

public class Views {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		Object obj = new Object();
		Controllers objctr = new Controllers();
		String dog;
		String cat;
		boolean isReal = true;
	do{	
		
		do{
			System.out.println("Nhap so thu nhat: ");
			dog = sc.nextLine();
			if(dog.isEmpty())
				System.out.println("Nhap lai gia tri so thu nhat: ");
			else
				obj.setA(Double.parseDouble(dog));
			
		}while(dog.isEmpty());
		
		
		do{
			System.out.println("Nhap so thu hai: ");
			dog = sc.nextLine();
			if(dog.isEmpty())
				System.out.println("Nhap lai gia tri so thu nhat: ");
			else
				obj.setB(Double.parseDouble(dog));
			
		} while(dog.isEmpty());
		
		do{
			System.out.println("Nhap phep tinh muon chon:");
			System.out.println("Cong la +, tru la -, nhan la x, chia la :");
			obj.setStrPhepToan(sc.nextLine());
			if(obj.getStrPhepToan().isEmpty())
				System.out.println("Phep tinh vua nhap k dung vui long nhap lai !!!: ");
			else
				objctr.kiemTraPhepTinh(obj);
				System.out.println("Ket qua tra ve la: " + objctr.getResult());
			
		} while(dog.isEmpty());
		System.out.println("Ban muon tiep tuc chu y/n: ");
		cat = sc.nextLine();
		if(cat.equals("y"))
			isReal = true;
		else
			isReal = false;
			System.out.println("Cam on da su dung dich vu ");
	}while(isReal == true);	
	}

}

